//根据超声波亮LED灯
//当物体距离传感器>=30cm，显示绿灯；当物体具体传感器<=10cm，显示红灯；否则显示黄灯。

#include "SetColor.h"
#include "GetCSB.h"

const int RPin = 9;
const int GPin = 10;
const int BPin = 11;
const int FsPin = 2;
const int JsPin = 3;

SetColor setcolor = SetColor(RPin, GPin, BPin);
GetCSB getCsb = GetCSB(FsPin,JsPin);

void setup() {
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(3, INPUT);
}

void loop() {
  float pos = getCsb.GetPos();
  Serial.println(pos);
  setcolor.UpdateColor(pos);

  delay(1000);
}
